home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 38 / Amiga Format CD38 (1999-03-15)(Future Publishing)(GB)(Track 1 of 3)[!][issue 1999-04].iso / -seriously_amiga- / misc / ced_html / html / html_formular_single.ced < prev    next >
Text File  |  1999-01-25  |  5KB  |  168 lines

  1. /*
  2. ** html_formular_single.ced
  3. **
  4. ** $VER: html_formular_single.ced 1.6 (01.04.1999)
  5. **
  6. ** Arexx script for HTML v3.2 formular single line input
  7. **
  8. ** This script works with CygnusEd Professional v4.2
  9. **
  10. ** Copyright © Eric BELLE
  11. */
  12.  
  13. /*
  14. **------------------------------------------------------------------------------
  15. **    Initialisation
  16. **------------------------------------------------------------------------------
  17. */
  18.  
  19. OPTIONS RESULTS                            /* Tell CygnusEd to return results. */
  20. NL = '0A'X                                    /* Alias for new line. */
  21. KRETURN = RAWKEY 68                    /* Shortcut to the return key. */
  22. KTAB = RAWKEY 66                        /* Shortcut to the tab key. */
  23. STATUS TABSARESPACES                /* Return TAB mode ("tab" or "space"). */
  24. IF RESULT = 1                                /* Test the TAB mode. */
  25. THEN "TABS = SPACES"                /* Switch TAB mode from "space" to "tab". */
  26. ELSE NOP                                        /* No operation. */
  27. TAB SIZE 1                                    /* Set TAB size proportional to 2 spaces. */
  28.  
  29. /*
  30. **------------------------------------------------------------------------------
  31. **    Input identification name
  32. **------------------------------------------------------------------------------
  33. */
  34.  
  35. GETSTRING '"Name"' '"Indentification name for the input?"'
  36. InputName = RESULT
  37.  
  38. IF (InputName=" " | InputName="RESULT")
  39. THEN EXIT 0
  40. ELSE NOP
  41.  
  42. /*
  43. **------------------------------------------------------------------------------
  44. **    Real input size
  45. **------------------------------------------------------------------------------
  46. */
  47.  
  48. GETNUMBER 10 '"Real input size?"' 0 32768
  49. RealInputSize = RESULT
  50.  
  51. IF (RealInputSize=" ")
  52. THEN EXIT 0
  53. ELSE NOP
  54.  
  55. /*
  56. **------------------------------------------------------------------------------
  57. **    Apparent input size
  58. **------------------------------------------------------------------------------
  59. */
  60.  
  61. GETNUMBER 5 '"Visual input size?"' 0 32768
  62. ApparentInputSize = RESULT
  63.  
  64. IF (ApparentInputSize=" ")
  65. THEN EXIT 0
  66. ELSE NOP
  67.  
  68. /*
  69. **------------------------------------------------------------------------------
  70. **    Input type
  71. **------------------------------------------------------------------------------
  72. */
  73.  
  74. InputType = "no"
  75. Do While (InputType="no")
  76.     OKAY2 "Data type:"                                        || NL ||,
  77.                 "~~~~~~~~~"                                            || NL ||,
  78.                 "  (t)ext         |  (d)ate      "        || NL ||,
  79.                 "  (i)nteger      |  (U)RL       "        || NL ||,
  80.                 "  (f)loat        |  (p)assword  "
  81.  
  82.     IF (RESULT=0)
  83.     THEN EXIT 0
  84.     ELSE InputType="ok"
  85.  
  86.     InputTypeMode = "q"
  87.     DO WHILE ~(InputTypeMode="t" | InputTypeMode="i" | InputTypeMode="f",
  88.                         | InputTypeMode="d" | InputTypeMode="U" | InputTypeMode="p",
  89.                         | InputTypeMode="RESULT" | InputTypeMode=" ")
  90.         GETSTRING "t" '"Data type mode: t, i, f, d, U, p?"'
  91.         InputTypeMode = RESULT
  92.     END
  93.  
  94.     IF (InputTypeMode="RESULT" | InputTypeMode=" ")
  95.     THEN InputType = "no"
  96.     ELSE NOP
  97. END
  98.  
  99. /*
  100. **------------------------------------------------------------------------------
  101. **    Input bounds
  102. **------------------------------------------------------------------------------
  103. */
  104.  
  105. IF (InputTypeMode="i" | InputTypeMode="f")
  106. THEN DO
  107.     GETNUMBER 1 '"Lower bound?"'
  108.     LowerBound = RESULT
  109.  
  110.     IF (LowerBound=" ")
  111.     THEN EXIT 0
  112.     ELSE NOP
  113.  
  114.     GETNUMBER 10 '"Upper bound?"'
  115.     UpperBound = RESULT
  116.  
  117.     IF (UpperBound=" ")
  118.     THEN EXIT 0
  119.     ELSE NOP
  120. END
  121. ELSE NOP
  122.  
  123. /*
  124. **------------------------------------------------------------------------------
  125. **    Html Input marks
  126. **------------------------------------------------------------------------------
  127. */
  128.  
  129. InputString =    '<INPUT NAME="'    ||    InputName            ||  '"'
  130. InputString = InputString            ||    " SIZE="            ||    ApparentInputSize
  131. InputString = InputString            ||    " MAXLENGTH="    ||    RealInputSize
  132.  
  133. SELECT
  134.     WHEN (InputTypeMode="t") THEN InputString = InputString || ">"
  135.     WHEN (InputTypeMode="i") THEN DO
  136.         InputString = InputString || " TYPE=INT"
  137.         InputString = InputString || " MIN=" || LowerBound
  138.         InputString = InputString || " MAX=" || UpperBound
  139.         InputString = InputString || ">"
  140.     END
  141.     WHEN (InputTypeMode="f") THEN DO
  142.         InputString = InputString || " TYPE=FLOAT"
  143.         InputString = InputString || " MIN=" || LowerBound
  144.         InputString = InputString || " MAX=" || UpperBound
  145.         InputString = InputString || ">"
  146.     END
  147.     WHEN (InputTypeMode="d") THEN InputString = InputString || " TYPE=DATE"            || ">"
  148.     WHEN (InputTypeMode="U") THEN InputString = InputString || " TYPE=URL"            || ">"
  149.     WHEN (InputTypeMode="p") THEN InputString = InputString || " TYPE=PASSWORD"    || ">"
  150.     OTHERWISE NOP
  151. END
  152.  
  153. /*
  154. **------------------------------------------------------------------------------
  155. **    Html Input structure
  156. **------------------------------------------------------------------------------
  157. */
  158.  
  159. TEXT InputString
  160.  
  161. /*
  162. **------------------------------------------------------------------------------
  163. **    End of html_formular_single.ced Arexx script
  164. **------------------------------------------------------------------------------
  165. */
  166.  
  167. EXIT 0
  168.